﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraNavBar;
namespace QUANLYCHAMCONG.PL.CMS
{
    public partial class MenuLeft : UserControl
    {
        #region "Event"
        private string _LinkName;
        public string LinkName
        {
            get { return _LinkName; }
            set { _LinkName = value; }
        }
        private bool _IsCheck;
        public bool IsCheck
        {
            get { return _IsCheck; }
            set { _IsCheck = value; }
        }
        #endregion
        //quan ly nhan vien
        public delegate void _DsNhanVien();
        public event _DsNhanVien DsNhanVien;
        public delegate void _LichsuNhanVien();
        public event _LichsuNhanVien LichsuNhanVien;
        public delegate void _HopDong();
        public event _HopDong HopDong;
        public delegate void _DangkyCa();
        public event _DangkyCa DangkyCa;
        public delegate void _Dangkydisomvetre();
        public event _Dangkydisomvetre Dangkydisomvetre;
        public delegate void _Dangkynghiphep();
        public event _Dangkynghiphep Dangkynghiphep;
        public delegate void _DangkyCongtac();
        public event _DangkyCongtac DangkyCongtac;
        public delegate void _DangkyVeSom();
        public event _DangkyVeSom DangkyVeSom;
        public delegate void _LichLamViec();
        public event _LichLamViec LichLamViec;
        public event _QuanTri ThemNhanvienTuFile;
        //Quan ly danh muc
        public delegate void _Thamso();
        public event _Thamso Thamso;
        public delegate void _Phongban();
        public event _Phongban Phongban;
        public delegate void _Chucvu();
        public event _Chucvu Chucvu;
        public delegate void _Bangcap();
        public event _Bangcap Bangcap;
        public delegate void _Nghenghiep();
        public event _Nghenghiep Nghenghiep;
        public delegate void _LoaiCongty();
        public event _LoaiCongty LoaiCongty;
        public delegate void _LoaiHinh();
        public event _LoaiHinh LoaiHinh;
        public delegate void _LoaiPhongBan();
        public event _LoaiPhongBan LoaiPhongBan;
        public delegate void _LoaiHopDong();
        public event _LoaiHopDong LoaiHopDong;
        public delegate void _Kyhieu();
        public event _Kyhieu Kyhieu;
        public delegate void _NgayLe();
        public event _NgayLe NgayLe;
        public delegate void _GioNgiTangCa();
        public event _GioNgiTangCa GioNgiTangCa;
        public delegate void _NgayPhep();
        public event _NgayPhep NgayPhep;
        public delegate void _Loaithoigian();
        public event _Loaithoigian Loaithoigian;
        public delegate void _Ca();
        public event _Ca Ca;
        //event for may cham cong
        public delegate void _LoaiMay();
        public event _LoaiMay LoaiMay;
        public delegate void _TocDo();
        public event _TocDo TocDo;
        public delegate void _KetNoi();
        public event _KetNoi KetNoi;
        public delegate void _MayChamCong();
        public event _MayChamCong MayChamCong;
        public delegate void _EventMaychamcong();
        public event _EventMaychamcong TaiDuLieu;
        public event _EventMaychamcong NhanvienMayChamcong;
        public event _EventMaychamcong DownloadNhanvien;
        public event _EventMaychamcong DownloadVantay;
        public event _EventMaychamcong Laydulieutufile;
        //he thong
        public delegate void _ThongTinCongTy();
        public event _ThongTinCongTy ThongTinCongTy;
        public delegate void _CauHinhHeThong();
        public event _CauHinhHeThong CauHinhHeThong;
        public delegate void _Backup();
        public event _Backup Backup;
        public delegate void _Retore();
        public event _Retore Retore;
        public delegate void _Logout();
        public event _Logout Logout;
        public delegate void _Thoat();
        public event _Thoat Thoat;
        public delegate void _ChangePass();
        public event _ChangePass ChangePass;
        // he thong quyen han
        public delegate void _QuanTri();
        public event _QuanTri Menu;
        public event _QuanTri Group;
        public event _QuanTri User;
        public event _QuanTri PhanQuyen;
        //bao cao 
        public delegate void _EventReport();
        public event _EventReport TimeOrigin;
        public event _EventReport CheckInOut;
        public event _EventReport Chamcongchitiet;
        public event _EventReport Thongke;
        public delegate void _ActiveLinece();
        public event _ActiveLinece dangkybanquyen;
        private DataTable _Authen;
        public DataTable Authen
        {
            get { return _Authen; }
            set { _Authen = value; }
        }
        public MenuLeft()
        {
            InitializeComponent();
        }

        private void nbnhanvien_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.DsNhanVien != null)
                this.DsNhanVien();
        }
        private void nblichsu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.LichsuNhanVien != null)
                this.LichsuNhanVien();
        }
        private void nbhopdong_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.HopDong != null)
                this.HopDong();
        }
        private void nbdangkycty_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.DangkyCa != null)
                this.DangkyCa();
        }
        private void nbdisomvetre_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Dangkydisomvetre != null)
                this.Dangkydisomvetre();
        }
        private void nbnghiphep_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Dangkynghiphep != null)
                this.Dangkynghiphep();
        }
        private void nbdicongtac_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.DangkyCongtac != null)
                this.DangkyCongtac();
        }
        private void nbthamso_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Thamso != null)
                this.Thamso();
        }
        private void navBarItem2_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Phongban != null)
                this.Phongban();
        }
        private void nbchucvu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Chucvu != null)
                this.Chucvu();
        }
        private void nbnghenghiep_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Nghenghiep != null)
                this.Nghenghiep();
        }
        private void nbloaicty_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.LoaiCongty != null)
                this.LoaiCongty();
        }
        private void nbloaihinh_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.LoaiHinh != null)
                this.LoaiHinh();
        }
        private void nbloaipb_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.LoaiPhongBan != null)
                this.LoaiPhongBan();
        }
        private void nbloaihd_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.LoaiHopDong != null)
                this.LoaiHopDong();
        }
        private void nbkyhieu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Kyhieu != null)
                this.Kyhieu();
        }
        private void nbngayphep_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.NgayPhep != null)
                this.NgayPhep();
        }
        private void nbngaynghi_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.NgayLe != null)
                this.NgayLe();
        }
        private void nbgionghi_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.GioNgiTangCa != null)
                this.GioNgiTangCa();
        }

        private void nbloaithoigian_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Loaithoigian != null)
                this.Loaithoigian();
        }

        private void nbloaimay_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.LoaiMay != null)
                this.LoaiMay();
        }

        private void nbtocdomay_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.TocDo != null)
                this.TocDo();
        }

        private void nbloaikn_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.KetNoi != null)
                this.KetNoi();
        }

        private void nbcty_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Ca != null)
                this.Ca();
        }

        private void nbcongty_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.ThongTinCongTy != null)
                this.ThongTinCongTy();
        }

        private void nbbangcap_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Bangcap != null)
                this.Bangcap();
        }

        private void nbdangkyca_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.DangkyCa != null)
                this.DangkyCa();
        }

        private void nbca_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Ca != null)
                this.Ca();
        }

        private void nbvesom_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.DangkyVeSom != null)
                this.DangkyVeSom();
        }

        private void nvcauhinhhethong_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.CauHinhHeThong != null)
                this.CauHinhHeThong();
        }

        private void nbsaoluu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Backup != null)
                this.Backup();
        }

        private void nbphuchoi_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Retore != null)
                this.Retore();
        }

        private void nbmaychamcong_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.MayChamCong != null)
                this.MayChamCong();
        }

        private void nblichlamviec_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.LichLamViec != null)
                this.LichLamViec();
        }

        private void nbdangsuat_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Logout != null)
                this.Logout();
        }

        private void nbmenu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Menu != null)
                this.Menu();
        }

        private void nbgroup_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Group != null)
                this.Group();
        }

        private void nbuser_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.User != null)
                this.User();
        }

        private void nbphanquyen_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.PhanQuyen != null)
                this.PhanQuyen();
        }

        private void nbimportnv_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.ThemNhanvienTuFile != null)
                this.ThemNhanvienTuFile();
        }

        private void nblaydulieuchamcong_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.TaiDuLieu != null)
                this.TaiDuLieu();
        }

        private void nbkenoimay_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.NhanvienMayChamcong != null)
            {
                this.NhanvienMayChamcong();
            }
        }

        private void nbdownloadnv_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.DownloadNhanvien != null)
                this.DownloadNhanvien();
        }

        private void lbaocaotheogionguon_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.TimeOrigin != null)
                this.TimeOrigin();
        }

        private void nbdownloadvantay_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.DownloadVantay != null)
            {
                this.DownloadVantay();
            }
        }

        private void nbbaocaoinout_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.CheckInOut != null)
                this.CheckInOut();
        }

        private void nbthoat_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Thoat != null)
                this.Thoat();
        }

        private void nbmenuleft_Click(object sender, EventArgs e)
        {

        }
        private void nbilaydulieutufile_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Laydulieutufile != null)
            {
                this.Laydulieutufile();
            }
        }

        private void nbichamcongchitiet_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Chamcongchitiet != null)
            {
                this.Chamcongchitiet();
            }
        }

        private void nbithongke_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.Thongke != null)
            {
                this.Thongke();
            }
        }

        private void nbchangepass_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (this.ChangePass != null)
                this.ChangePass();
        }
        public void Active()
        {
            if (Authen.Rows.Count != 0)
            {
                foreach (DataRow dr in Authen.Rows)
                {
                    foreach (NavBarGroup gr in nbmenuleft.Groups)
                    {
                        if (gr.Name == dr["MENUVALUE"].ToString())
                        {
                            gr.Visible = true;
                            break;
                        }
                    }
                }
                foreach (DataRow dr in Authen.Rows)
                {
                    foreach (NavBarItem item in nbmenuleft.Items)
                    {
                        if (item.Name == dr["MENUVALUE"].ToString())
                        {
                            item.Visible = true;
                        }
                    }
                }
            }
        }

        private void MenuLeft_Load(object sender, EventArgs e)
        {
           
        }

        private void nbbanquyen_LinkClicked(object sender, NavBarLinkEventArgs e)
        {
            if (this.dangkybanquyen != null)
                this.dangkybanquyen();
        }
    }
}


